Repository navigation
feat(rust): port the TypeScript validation passes to the Rust loader - #605
Merged
Merged
Conversation
…, R10) The Rust loader now runs all 48 validation passes of the reference loader, in the reference's order: structure, attribute schema, field, persistence, origin, relationships, reporting, prompt and requirement vocabulary, plus the merge warnings and the extender subtype scope warning. The shared metamodel corpus passes 526 of 526 fixtures and the conformance ledger is empty (minPassing 526). The YAML corpus passes 18 of 19 (yaml-ref-root-escape stays on its ledger: root-level `::` references are a reference-resolution feature, not a validation pass). Load time before and after, same machine, alternating runs, median of 7 rounds, 20x model. The machine was heavily loaded (load average 34), so read the ratios, not the milliseconds. | item | before ms | after ms | change | |---|---:|---:|---:| | total load | 27.416 | 44.032 | +61% | | validation | 0.000 | 21.455 | new | | json parse | 4.262 | 3.822 | -10% | | tree build | 14.432 | 12.042 | -17% | | merge | 1.137 | 0.967 | -15% | | super resolution | 0.254 | 0.240 | -6% | | reference resolution | 4.585 | 4.041 | -12% | | freeze | 0.070 | 0.064 | -9% | | peak memory | 34.0 MiB | 34.6 MiB | +2% | Largest passes: reporting 6.7 ms, attr schema 4.2 ms, registered validation 1.4 ms, max occurs 1.2 ms, column name collisions 0.9 ms. Total load rises more than 20 percent because validation is new work the loader skipped before; the pre-existing phases did not slow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The Rust loader (preview, ADR-0065) now runs every validation pass the TypeScript loader runs, in the reference order: 40 passes (the commit message of the first commit says 48; the correct count is 40, and every one of the reference's 40 validators is present). They cover structure, the attribute schema, fields (policy, expressions, defaults, enums, maps, mutability), persistence (sources, roles, physical names, column-name collisions), origins, relationships (including M:N junction pairing), reporting, prompts and requirement vocabulary, plus merge handling (
ERR_MERGE_CONFLICT,WARN_DUPLICATE_DECLARATION), the extender subtype scope warning and the legacy warning channel.validate.rsbecame avalidate/module with one file per concern and shared helpers inutil.rs.This is the one bundled PR for the remaining parity work (structure and field passes through the prompt and requirement vocabulary), after the measurement PR (602) and the YAML, config and naming PR (603).
Conformance
minPassingis 526.yaml-ref-root-escape, which needs root-level::reference resolution (not a validation pass).cargo fmt,clippy -D warningsand the crate tests are green.Load time before and after
Same machine, back to back, alternating runs, median of 7, the 20x model (7,140 nodes). The machine was busy (load average about 22), so read the ratios.
Largest passes:
Total load rises by about 90 percent. That is more than the 20 percent line and it is expected: validation is new work the loader skipped before, and it is 18.3 ms of the 38.5 ms. The phases that already existed did not slow (json parse +1%, tree build -6%, merge -3%, reference resolution -2%). Peak memory is +2% (34.0 to 34.6 MiB). The biggest passes are
reportingand the attribute schema; both are the first candidates for a speed pass.Public loader surface added
Two options on
Loader, nothing else new:Loader::strict(bool)(default false; the conformance runner loads strict) andLoader::naming(NamingCtx), which carries both the naming registry and the projectPhysicalNamingso custom column strategies and pluralizers resolve as in the TypeScript reference.Loader::newkeeps the built-in registry and default naming, so existing callers are unchanged. An unknown strategy gives one error per load.Gate
One no-mistakes run (run count: 1). The review step went three rounds on parity defects the corpus could not see, each fixed in this PR on the maintainer's decision: the
@viareverse-hop name (own-only@collectionNameand the project pluralizer), project naming through the loader (naming.columns,naming.collections, custom strategies), and the duplicate enum and@dbColumnTypechecks (array-valued@intValueMapand an integral float such as1.0now match the reference). Test, document and lint passed. CI is local (ci_mode: local), so no forge checks run.